Option Public
Option Declare

Sub LaunchSiteFromDoc ( ) 
	
	'--------------------------------------------------------	
	' Launch the Web site from the document.
	' Display a warning message if there's a 
	' problem with the browser configuration.
	'--------------------------------------------------------
	On Error Goto oops
	Dim w As New NotesUIWorkspace
	Dim uidoc As NotesUIDocument
	Dim doc As NotesDocument
	Dim siteName As String
	
	Set uidoc = w.CurrentDocument
	Set doc = uidoc.Document
	siteName = doc.Link(0)
	Print "Launch website: " siteName
	Call w.URLOpen ( siteName )
	Exit Sub
	
oops:
	Msgbox "Browser error.  The Internet browser "+_
	"may not be configured " +Chr$(13)+ " correctly.  "+_
	"Check your location document in your address "+_
	" book "+Chr$(13)+"or contact the help desk for "+_
	"additional assistance." 	
	Resume
	
End Sub


Sub LaunchSiteFromView
	
	'--------------------------------------------------------	
	' Launch the Web site from the view.
	' Display a warning message if there's a 
	' problem with the browser configuration.
	'--------------------------------------------------------
	On Error Goto oops	
	Dim s As notessession   
	Dim db As notesDatabase       
	Dim collection As NotesDocumentCollection
	Dim doc As NotesDocument    
	Dim w As New NotesUIWorkspace
	Dim siteName As String
	
	Set s = New NotesSession
	Set db = s.CurrentDatabase                
	Set collection = db.UnprocessedDocuments
	
	If collection.count = 0 Then
		Msgbox ("Please select a Web site.  "+_
		"The current selection is a category.")
	Elseif collection.count > 1 Then
		Msgbox ("Please select only one document.")
	Else
		Set doc = collection.GetFirstDocument
		siteName = doc.Link(0)
		Print "Launch website: " siteName
		Call w.URLOpen ( siteName )
	End If
	Exit Sub
	
oops:
	Msgbox "Browser error.  The Internet browser "+_
	"may not be configured " +Chr$(13)+ " correctly.  "+_
	"Check your location document in your address "+_
	" book "+Chr$(13)+"or contact the help desk for "+_
	"additional assistance." 	
	Resume
	
End Sub


Function CheckFieldValues ( DocRef As NotesDocument )
	
	'--------------------------------------------------------	
	' Declare fields.
	'--------------------------------------------------------
	Dim MsgText As String
	CheckFieldValues = True
	MsgText = ""
	
	'--------------------------------------------------------	
	' Validate each field
	'--------------------------------------------------------
	If Trim(DocRef.Title(0)) = "" Then
		MsgText = MsgText + "Specify a Site Name." + Chr$(13)
	End If	
	
	If Trim(DocRef.Link(0)) = "" Then
		MsgText = MsgText + "Specify a Web Link." + Chr$(13)
	End If	
	
	If Trim(DocRef.Category(0)) = "" Then
		MsgText = MsgText + "Specify a Category." + Chr$(13)
	End If	
	
	'--------------------------------------------------------	
	' Display message if fields are invalid.
	'--------------------------------------------------------	
	If MsgText <> "" Then
		Msgbox MsgText,16,"Required Fields."
		CheckFieldValues = False
	End If	
	
End Function

